package com.example.win.android_banduyujia.peopleactivity.fragment.projectfragment.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.example.win.android_banduyujia.R;
import com.example.win.android_banduyujia.entity.MyProjectEntity;
import com.example.win.android_banduyujia.http.request.AsycHttpRequest;
import com.example.win.android_banduyujia.login.application.LoginApplication;
import com.example.win.android_banduyujia.peopleactivity.fragment.projectfragment.database.MyCourseDatabase;

import java.util.List;

/**
 * Created by Win on 2015/8/28.
 */
public class FragmentAdapter extends RecyclerView.Adapter implements RecyclerView.OnScrollListener{

    private static final int VIEW_TYPE_FILM_DETAIL = 0;
    private String[]  dabaset;
    private List<MyProjectEntity> listDatas;
    private String  mAccressToken;
    private Context mContext;

    private int isScrolling;

    private AsycHttpRequest mAsycHttpRequest = new AsycHttpRequest();

    public FragmentAdapter(String[] dabaset) {

    }

    public FragmentAdapter(Context context, List<MyProjectEntity>  Lists) {
          this.mContext = context;
          this.listDatas = Lists;
          mAccressToken = LoginApplication.getInstance().getAccessToken();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View  view = View.inflate(viewGroup.getContext(), R.layout.view_wait_project_item, null);

        return new OrderListViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int i) {
        /*OrderListViewHolder  holder1= (OrderListViewHolder) holder;
        holder1.position = i;
        MyProjectEntity  entity = list.get(i);
        holder1.mTxtBase.setText(entity.getmBaseProject());
        holder1.mTxtTime.setText(entity.getMonth()+entity.getWeek()+entity.getTime());*/
        //将数据保存在itemView的Tag中，以便点击时进行获取
        holder.itemView.setTag(listDatas.get(i));
    }

    @Override
    public int getItemCount() {
        if (null != listDatas){
            return listDatas.size();
        }
        return 0;
    }

    public void setListDatas(List<MyProjectEntity> listDatas) {
        this.listDatas = listDatas;
    }

    @Override
    public void onScrollStateChanged(int i) {
        this.isScrolling = i;
    }

    @Override
    public void onScrolled(int i, int i1) {

    }

    private interface ViewCreateMethods{

    }

    private class OrderListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,ViewCreateMethods {

        private LinearLayout  LayoutItem;
        private LinearLayout  LayoutProject;

        public  int  position;
        private List<MyProjectEntity> mListData;

        public OrderListViewHolder(View itemView) {
            super(itemView);

            LayoutItem = (LinearLayout) itemView.findViewById(R.id.layout_no_project_view_item);
            LayoutProject = (LinearLayout) itemView.findViewById(R.id.layout_linear_today_page);

            LayoutItem.setOnClickListener(this);
            LayoutProject.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {

        }
    }
}
